/* soivpsti.p - SALES ORDER INVOICE POST TRANSACTION HISTORY UPDATE     */
/* Copyright 1986-2004 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.2.1.3.3.2 $                                                   */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 8.5      CREATED: 12/08/97   BY: *J27M* Seema Varma        */
/* REVISION: 8.6     MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6      LAST MODIFIED: 08/12/99   BY: *J3KJ* Bengt Johansson   */
/* REVISION: 9.1      LAST MODIFIED: 10/29/99   BY: *N004* Steve Nugent      */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KN* myb               */
/* Revision: 1.2.1.3.3.1  BY: Prashant Parab  DATE: 02/11/04   ECO: *P1N1* */
/* $Revision: 1.2.1.3.3.2 $  BY: Salil Pradhan  DATE: 03/02/04  ECO: *P1GM* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
         define input parameter l_sonbr      like so_nbr     no-undo.
         define input parameter l_sodline    like sod_line   no-undo.
         define input parameter l_inv_nbr    like so_inv_nbr no-undo.
         define input parameter l_eff_date   like tr_gl_date no-undo.
define shared variable using_seq_schedules like mfc_logical no-undo.
define shared temp-table so_shipper_info no-undo
   field tt_ship_id like tr_ship_id
   field tt_nbr like so_nbr
   field tt_line like sod_line
   field tt_inv_nbr like so_inv_nbr
   index tt_ship_id tt_nbr tt_line tt_inv_nbr.

define shared temp-table work_trnbr no-undo
   field work_sod_nbr  like sod_nbr
   field work_sod_line like sod_line
   field work_tr_recid  like tr_trnbr
   index work_sod_nbr work_sod_nbr ascending.

for each work_trnbr no-lock
      where work_sod_nbr = l_sonbr and
      work_sod_line = l_sodline:

   for first tr_hist
      fields (tr_rmks tr_gl_date tr_ship_id tr_nbr tr_line)
      where
      recid(tr_hist) = work_tr_recid
   exclusive-lock:
   end.

   if available (tr_hist)
      and tr_type = "ISS-SO"
   then do:
      assign
         tr_hist.tr_rmks    = l_inv_nbr
         tr_hist.tr_gl_date = l_eff_date.

      if using_seq_schedules then do:
         create so_shipper_info.
         assign
            tt_ship_id = "s" + tr_ship_id
            tt_nbr = tr_nbr
            tt_line = tr_line
            tt_inv_nbr = l_inv_nbr.

         if recid(so_shipper_info) = -1 then .
      end.  /* if using_seq_schedules */
   end.  /* if available (tr_hist) */

end. /* for each work_trnbr */
